/*
 * To change this license header, choose License Headers in Project Properties. To change this
 * template file, choose Tools | Templates and open the template in the editor.
 */
package chalmers.game.subterranean.model.inventory;

import chalmers.game.subterranean.model.items.IEquippableItem;
import chalmers.game.subterranean.util.Resource;
import java.util.ArrayList;

import chalmers.game.subterranean.util.options.PlayerValues;
import lombok.Getter;
import lombok.Setter;

/**
 * 
 * @author TH
 * 
 *         Revision: Broke in to this class like a burglar. Sorry for that. Alex Evert
 */
public class Inventory {

  private final ArrayList<Resource> items;
  private final ArrayList<Resource> resources;
  private ArrayList<IEquippableItem> equippableItems;
  private int currentItem = 0;

  private @Getter
  @Setter
  double money;

  public Inventory() {
    items = new ArrayList<Resource>();
    resources = new ArrayList<>();
    money = PlayerValues.STARTING_CREDITS;
    equippableItems = new ArrayList<>();
  }

  public void addItem(IEquippableItem item) {
    equippableItems.add(item);
  }

  public IEquippableItem getNextItem() {
    if (equippableItems.size() == 0) {
      return null;
    }
    currentItem++;
    if (currentItem == equippableItems.size()) {
      currentItem = 0;
    }
    return equippableItems.get(currentItem);
  }

  public void add(Resource theItem) {
    if (theItem.equals(Resource.NOTHING)) {
      return;
    }
    items.add(theItem);
  }
}
